package com.xaicode.template.gendata.chinese;

import com.xaicode.template.gendata.base.Generator;
import org.apache.commons.lang3.RandomUtils;

/**
 * @author Locker xaicode@sina.com
 * @version 1.0
 * @date 2022/5/24 0024 20:58
 */
public class CnAddr extends Generator {

    private static CnAddr instance = new CnAddr();

    private CnAddr() {
    }

    public static CnAddr getInstance() {
        return instance;
    }

    @Override
    public String generate() {
        StringBuilder result = new StringBuilder(genProvinceAndCity());
        result.append(CnCharUtil.genRandomLengthChineseChars(2, 3) + "路");
        result.append(RandomUtils.nextInt(1, 8000) + "号");
        result.append(CnCharUtil.genRandomLengthChineseChars(2, 3) + "小区");
        result.append(RandomUtils.nextInt(1, 20) + "单元");
        result.append(RandomUtils.nextInt(101, 2500) + "室");
        return result.toString();
    }

    private static String genProvinceAndCity() {
        return CnArea.provinceCityList.get(
                RandomUtils.nextInt(0, CnArea.provinceCityList.size()));
    }

}
